<html>
    <head>
        <meta charset="utf-8">
        <link href="__CSS__bootstrap.min.css" type="text/css" rel="stylesheet">
        <link href="__CSS__writeText.css" type="text/css" rel="stylesheet">

        <script src="__JS__jquery-3.1.1.min.js"></script>
        <script src="__JS__bootstrap.min.js"></script>

    </head>
    <body>
        <div class="navbar navbar-default">
            <div class="container-fluid">
                <div class="navbar-header">
                    <span class="navbar-brand">文章编辑</span>
                </div>
                 <ul class="nav navbar-nav  navbar-right">
                    <li><a href="__ADMIN__Article/index">返回首页</a></li>
                </ul>
            </div>
        </div>

        <!--body-->
            <form class="form-horizontal col-sm-offset-1 col-sm-10 col-md-offset-1 col-md-10 container-fluid panel panel-default" style="background-color: #FCFFFF;" method="POST">
                <div class="form-group panel-body">
                    <h3 class="col-sm-12 col-md-12">标题</h3>
                    <div class="col-sm-12 col-md-12">
                    <input type="text" class="form-control" name="title" placeholder="请输入文章标题">
                    </div>
                </div>

                 <div class="form-group panel-body">
                    <h3 class="col-sm-12 col-md-12">文章分类</h3>
                    <select class="form-control" style="width:10%;margin-left: 1em;">
                        <option class="col-sm-2 col-md-2">原创</option>
                        <option class="col-sm-2 col-md-2">转载</option>
                    </select>
                 </div>

                <div class="form-group  panel-body">
                    <h3 class="col-sm-12 col-md-12">文章标签</h3>
                     <div class="col-sm-12 col-md-12" id="type">

                         <!--标签-->
                         <div class="col-sm-12 col-md-12 font  panel panel-default">
                             <h4>可选标签</h4>
                             <div class="panel-body Labe" id="tags1">
                                 <volist name="tags" id="vo">
                                     <if condition="$vo['id']%6 eq 0">
                                         <a style="margin: 0.2em 0.1em;" class="tag"><span class="Labe2 label label-default">{$vo.name}</span></a>
                                         <elseif condition="$vo['id']%6 eq 1"/>
                                         <a style="margin: 0.2em 0.1em;" class="tag"><span class="Labe2 label label-primary">{$vo.name}</span></a>
                                         <elseif condition="$vo['id']%6 eq 2"/>
                                         <a style="margin: 0.2em 0.1em;" class="tag"><span class="Labe2 label label-success">{$vo.name}</span></a>
                                         <elseif condition="$vo['id']%6 eq 3"/>
                                         <a style="margin: 0.2em 0.1em;" class="tag"><span class="Labe2 label label-info">{$vo.name}</span></a>
                                         <elseif condition="$vo['id']%6 eq 4"/>
                                         <a style="margin: 0.2em 0.1em;" class="tag"><span class="Labe2 label label-warning">{$vo.name}</span></a>
                                         <elseif condition="$vo['id']%6 eq 5"/>
                                         <a style="margin: 0.2em 0.1em;" class="tag"><span class="Labe2 label label-danger">{$vo.name}</span></a>
                                     </if>
                                 </volist>
                             </div>

                         </div>
                         <div class="col-sm-12 col-md-12 font  panel panel-default">
                             <h4>已选标签</h4>
                             <div id="tags2" class="panel-body Labe">

                             </div>
                         </div>
                     </div>
                     <input type="text" hidden id="hiddentype" name="type"/>
                </div>

				<!--时间-->
				<input type="text" hidden id='time' name='time' value=''>
                <div class="form-group  panel-body">
                    <h3 class="col-sm-12">文章内容</h3>
                    <div class="col-sm-12">
                        <textarea id="content" name="context"></textarea>
                    </div>
                </div>

                <div class="form-group  panel-body">
                    <div class="col-sm-12 col-md-12 text-center">
                    <button type="submit" class="btn btn-primary" id="sb">提交</button>
                    <button type="submit" class="btn btn-primary">保存</button>
                    </div>
                </div>
        </form>


    </body>
    <script type="text/javascript" src="__PUBLIC__ckeditor/ckeditor.js"></script> 
    <script type="text/javascript"> 
	
	 //时间返回
    function getNowFormatDate() {
        var date = new Date();
        var seperator1 = "-";
        var seperator2 = ":";
        var month = date.getMonth() + 1;
        var strDate = date.getDate();
        if (month >= 1 && month <= 9) {
            month = "0" + month;
        }
        if (strDate >= 0 && strDate <= 9) {
            strDate = "0" + strDate;
        }
        var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
                + " " + date.getHours() + seperator2 + date.getMinutes()
                + seperator2 + date.getSeconds();
        return currentdate;
    }
	
        CKEDITOR.replace("content");

        $('.tag').on('click',function(){
            var obj = $(this);
            if($(this).is('.active')){
                $(this).removeClass('active');
                $('#tags1').append(obj);
            }else{
                $(this).addClass('active');
                $('#tags2').append(obj);
            }

//            $('#selectType').empty();


        });
        $('#sb').on('click',function(){
            var obj = $("#tags2 span"),text=null;
            //$(function(){console.log(obj);});
            for(var i=0;i<obj.length;++i){
				if(i==0){text='';}
                if(i!=0&&i!=obj.length){
                    text = text + ','+ $(obj).text();
                }
                else{
                    text += $(obj).text();
                }
            }
            //console.log(text);
            if(text == null){
                text = "未分类";
            }
            $('#hiddentype').val(text);
			$('#time').val(getNowFormatDate());
        });
    </script>
</html>